home *** CD-ROM | disk | FTP | other *** search
- Path: ccshst05.cs.uoguelph.ca!ccshst01!thay
- From: thay@uoguelph.ca (Toby K Hay)
- Newsgroups: comp.lang.c
- Subject: Re: A question on for loop
- Date: 13 Mar 1996 19:23:54 GMT
- Organization: University of Guelph
- Message-ID: <4i77ca$161@ccshst05.cs.uoguelph.ca>
- References: <31471574.79D9@hdc-usa.com>
- NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- Phil Boyd (boydp@hdc-usa.com) wrote:
- : > |>
- : > |> for(i=0;i< 20; i++)
- : > |> {
- : > ...
- : > |> if(condition==FALSE)
- : > |> continue;
- : > ...
- : > |> }
-
- : OK, now for a newbie question just for my own edification:
- : Inside the for loop - does "i" start off with the value 0 so that
- : the loop has the potential to repeat up to 20 times (assuming that
- : "condition" remains FALSE)?
-
- My novice's answer is yes, i starts off at 0 because the for statement
- (i=0;i<20;i++) has i++ meaning that i is incremented after the
- operation. If it were (i=0;i<20;++i) then i would start at 1 and run up
- to 20. Is this correct?
- Toby Hay thay@uoguelph.ca
-